Many C/C++ binaries are compiled to be position dependent, which means that each binary is built to be loaded into, and executed from, a particular address or virtual address in memory. The addresses or virtual addresses of functions and global variables are the same on every invocation of a position-dependent binary. However, this position-dependence exposes a binary to security risks. To avoid these security risks, binaries are created which are position independent.
Position independent binaries can be loaded into different virtual address ranges on every invocation. This technique is known as address space layout randomization (ASLR) and can stop many security attacks that depend on knowing the address of a function, symbol, or variable in a particular binary. However, creating position independent binaries may cause non-trivial performance issues. Using conventional position independence techniques to compile binaries requires extra memory load operations when accessing global variables. These extra memory loads may cause performance deteriorations in binary executions.
As recognized by the inventors, there should be compilation techniques that reduce the number of memory loads required to access global variables when creating executable binaries for position independent code.